﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Iesi.Collections;
using Iesi.Collections.Generic;
using System.Collections.ObjectModel;

namespace VisualAgile.Model
{
    [Serializable]
    public class Iteration  
    {       
        /// <summary>
        /// Created Date
        /// </summary>
        public virtual DateTime CreateTime
        {
            get;
            set;
        }

        /// <summary>
        /// Created by
        /// </summary>
        public virtual System.String Creator
        {
            get;
            set;
        }

        /// <summary>
        /// Release ID
        /// </summary>
        public virtual Guid IterationID
        {
            get;
            set;
        }

        /// <summary>
        /// Project ID
        /// </summary>
        public virtual Guid ReleaseID
        {
            get;
            set;
        }      

        /// <summary>
        /// Release name
        /// </summary>
        public virtual System.String Name
        {
            get;
            set;
        }

        /// <summary>
        /// Release period start date
        /// </summary>
        public virtual System.DateTime PeriodFrom
        {
            get;
            set;
        }

        /// <summary>
        /// Release period end date
        /// </summary>
        public virtual System.DateTime PeriodTo
        {
            get;
            set;
        }

        private ISet<Story> _stories = new HashedSet<Story>();

        public virtual ReadOnlyCollection<Story> Stories
        {
            get { return new List<Story>(_stories).AsReadOnly(); }
        }

        public virtual void AddStory(Story story)
        {
            story.IterationID  = this.IterationID.ToString();
            _stories.Add(story);
        }

        public virtual void RemoveStory(Story n)
        {

        }

        private ISet<Label> _labels = new HashedSet<Label>();

        public virtual ReadOnlyCollection<Label> Labels
        {
            get { return new List<Label>(_labels).AsReadOnly(); }
        }

        public virtual void AddLabel(Label label)
        {
            label.IterationID = this.IterationID.ToString();
            _labels.Add(label);
        }

        public virtual void RemoveLabel(Label n)
        {

        }
    }
}
